<?php
include_once('./common.php');
/* 
echo "\$_SGLOBAL\n";
print_r($_SGLOBAL);
echo "\$_SCONFIG\n";
print_r($_SCONFIG);
echo "\$_SBLOCK\n";
print_r($_SBLOCK);
echo "\$_TPL\n";
print_r($_TPL);
echo "\$_SCOOKIE\n";
print_r($_SCOOKIE);
echo "\$_SN\n";
print_r($_SN);
echo "\$space\n";
print_r($space);
 */

echo get_avatar(1);
 
function get_avatar($uid, $size = 'middle', $type = '') {
	$size = in_array($size, array('big', 'middle', 'small')) ? $size : 'middle';
	$uid = abs(intval($uid));
	$uid = sprintf("%09d", $uid);
	$dir1 = substr($uid, 0, 3);
	$dir2 = substr($uid, 3, 2);
	$dir3 = substr($uid, 5, 2);
	$typeadd = $type == 'real' ? '_real' : '';
	return $uid.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($uid, -2).$typeadd."_avatar_$size.jpg";
}
?>